<?php require_once('Connections/cnn.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
  
  $logoutGoTo = "Contactenos.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "Admin,User,Client";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "error.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
$colname_usuarios = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_usuarios = $_SESSION['MM_Username'];
}
mysql_select_db($database_cnn, $cnn);
$query_usuarios = sprintf("SELECT * FROM usuario WHERE Email = %s", GetSQLValueString($colname_usuarios, "text"));
$usuarios = mysql_query($query_usuarios, $cnn) or die(mysql_error());
$row_usuarios = mysql_fetch_assoc($usuarios);
$totalRows_usuarios = mysql_num_rows($usuarios);
?>


<!doctype html>
<html><!-- InstanceBegin template="/Templates/plantilla.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Ventas</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css">
<link href="css/menu3.css" rel="stylesheet" type="text/css">
<!-- InstanceEndEditable -->
<link href="css/estilo.css" rel="stylesheet" type="text/css">

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- InstanceBeginEditable name="1" -->
<!-- Skitter JS -->
  <script type="text/javascript" language="javascript" src="js/jquery-1.6.3.min.js"></script>
  <script type="text/javascript" language="javascript" src="js/menu.js"></script>
  <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
  <script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>

   


<![endif]-->


<!-- InstanceEndEditable -->

</head>


<body> 


<div class="container">
  <header>
    <img src="images/banner.png" width="960" height="194" />
     <ul class="menu3">
    <li> <a href="#">Bienvenido/@: <?php echo $row_usuarios['Usuario']; ?></a>
 
        <ul>
          <?php if($_SESSION['MM_UserGroup']=='Admin'){ ?>


            <li><a href="admin/index2.php" class="ele">Administracion del sitio</a></li> <?php } ?>
            <li><a href="<?php echo $logoutAction ?>" class="auvi">Cerrar Sesion</a></li>
        </ul>
    </li>
    
</ul>
 
  </header>
   <ul class="menu">
            <li><a href="index_r.php">Home</a></li>
            <li><a href="Productos_r.php">Productos</a></li>
            <li><a href="#">Acerca</a></li>
            <li><a href="Contactenos_r">Contactanos</a></li>
        </ul>
 
   <br><br>


  <!-- InstanceBeginEditable name="2" -->
    <script type="text/javascript">
            $(document).ready(function() {
                $('.menu').tagdrop({tagPaddingTop: '60px',bgColor: '#B1CCED',bgMoverColor: '#7FB0F0',textColor: '#e0e0e0'});
            });
        </script>
  <table width="20%" border="0" id="numeros7">
    <tr>
      <td>
        <form id="formulario" name="formulario" method="post" action="enviar-mail.php" enctype="application/x-www-form-urlencoded">
        <table width="20%" border="0" id="sidebar3">
        <tr>
          <td><p>Nombre: </p>
            <p>
              <label for="nombre"></label>
              <span id="sprytextfield1">
              <input type="text" name="nombre" id="nombre">
              <span class="textfieldRequiredMsg">*</span></span></p></td>
          </tr>
        <tr>
          <td><p>Ingrese su Correo: </p>
            <p>
              <label for="correo"></label>
              <span id="sprytextfield2">
              <input type="text" name="correo" id="correo">
              <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Formato no válido.</span></span></p></td>
          </tr>
        <tr>
          <td><p>Asunto:</p>
            <p><select name="asunto"><option value="comentario">Comentario</option><option value="pregunta">Pregunta</option><option value="sugerencia">Sugerencia</option></select></p></td>
          </tr>
        <tr>
          <td><p>Mensaje: </p>
            <p>
              <label for="mensaje"></label>
              <span id="sprytextarea1">
              <textarea name="mensaje" id="mensaje"></textarea>
              <span class="textareaRequiredMsg">*</span></span></p></td>
          </tr>
        <tr>
          <td><P><input type="submit" name="Enviar" id="Enviar" value="Enviar"></P>
   <?php
              error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
            if(isset($_GET['respuesta'])){
            echo"<span>".$_GET['respuesta']."</span>";
            }

           ?>   
          </td>
        
          </tr>
  </table>
  </form>
  </td>
    </tr>
</table>
 
 
 
  <script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1");
  </script>
  
  
    <div id="sidebar65">
      <center><h1>Contactanos</h1></center>
     <p>Visitanos en nuestras tiendas te atenderemos al instante.</p>
     <p>Dirección: .</p>
     <p>Telefonos: 2247-8732  2247-9054</p><br>
     <p>Mapa de Ubicación</p>
     <center><iframe width="470" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.sv/maps?ie=UTF8&amp;q=TADROS&amp;fb=1&amp;gl=sv&amp;hq=tadros&amp;hnear=0x8f633067b411775d:0x1f75978893fb5c96,San+Salvador&amp;cid=0,0,11713729818612317055&amp;t=m&amp;ll=13.716213,-89.246144&amp;spn=0.006295,0.006295&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.sv/maps?ie=UTF8&amp;q=TADROS&amp;fb=1&amp;gl=sv&amp;hq=tadros&amp;hnear=0x8f633067b411775d:0x1f75978893fb5c96,San+Salvador&amp;cid=0,0,11713729818612317055&amp;t=m&amp;ll=13.716213,-89.246144&amp;spn=0.006295,0.006295&amp;source=embed" style="color:#0000FF;text-align:left">Ver mapa más grande</a></small></center>
    </div>
    
  <!-- InstanceEndEditable -->

  <footer>
    <h3>Super Gangas</h3>
  </footer>
  <!-- end .container --></div>
</body>
<!-- InstanceEnd --></html>